﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BaseData.UI;
using TaxBiz.OaSys;
using TaxEntity.User;

namespace Admin.AjaxPage.Oa
{
    /// <summary>
    /// OA站点 接口
    /// </summary>
    public partial class Email : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string action = PageContext.GetRequest("action");
            if (action == "sendemail")
            {
                SendEmail();
            }
        }

        protected void SendEmail()
        {
            string subject = PageContext.GetRequest("subject");
            string content = PageContext.GetRequest("content");
            string mailto = PageContext.GetRequest("mailto");
            if (string.IsNullOrEmpty(subject) || string.IsNullOrEmpty(content) || string.IsNullOrEmpty(mailto))
            {
                Response.Write("0");
                Response.End();
            }
            subject = System.Web.HttpContext.Current.Server.HtmlDecode(subject);
            content = System.Web.HttpContext.Current.Server.HtmlDecode(content);
            subject = System.Web.HttpContext.Current.Server.UrlDecode(subject);
            content = System.Web.HttpContext.Current.Server.UrlDecode(content);
            UserEntity model = new UserEntity();
            bool isSuccess = EmailBiz.SendBatch(model, subject, content, mailto);
            if (isSuccess)
            {
                Response.Write("1");
                Response.End();
            }
            else
            {
                Response.Write("0");
                Response.End();
            }

        }
    }
}